<template>
  <div class="home">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="title" label="日期" width="180"> </el-table-column>
      <el-table-column prop="id" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="type" label="地址"> </el-table-column>
      <el-table-column prop="nav" label="地址"> </el-table-column>
    </el-table>
    <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :total="total"> </el-pagination>
  </div>
</template>

<script>
import axios from "axios"
export default {
  name: "Home",
  data() {
    return {
      total:0,
      tableData: [],
    };
  },
  methods:{
    async http(pageIndex=0,pageSize=5){
      const res=await axios.get('/api/getlist',{params:{
        pageIndex,pageSize
      }})
      console.log(res)
      this.tableData=res.data.data
      this.total=res.data.total
    },
    handleCurrentChange(index){
      console.log(index)
      this.http(index)
    }
  },
  created(){
    this.http()
  }
};
</script>
